package com.baor.service.impl;

import com.baor.base.config.TokenService;
import com.baor.base.domain.UserVO;
import com.baor.service.SUserService;

import com.baor.base.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class SUserServiceImpl implements SUserService {

    @Autowired
    private TokenService tokenService;
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public Map<String,Object> login() {
        UserVO userVO = new UserVO();
        userVO.setUserId(1);
        userVO.setUserName("admin");
        userVO.setUserPassword("admin");
        String token = tokenService.createToken(userVO);
        this.redisUtil.setValue("loginUser:"+userVO.getUserId(),token);
        Map<String,Object> map = new HashMap<>();
        map.put("token",token);
        return map;

    }
}
